import 'dart:async';

import 'package:enterprise_v6_app/app/core/core.dart';

/// 提交成功
class SubmitSuccess extends StatelessWidget {
  const SubmitSuccess({super.key});

  @override
  Widget build(BuildContext context) {
    //设置一秒后关闭弹窗并且返回
    const timeout = Duration(seconds: 1);
    Timer(timeout, () {
      Navigator.pop(context);
      Get.back(result: true);
    });
    return WillPopScope(
      child: Container(
        alignment: Alignment.center,
        child: Container(
          width: 300.w,
          height: 260.w,
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.all(Radius.circular(20.w)),
            gradient: const LinearGradient(
                //渐变位置
                begin: Alignment.topCenter,
                end: Alignment.bottomCenter,
                //渐变颜色[始点颜色, 结束颜色]
                colors: [
                  Color(0xffE7EAFF),
                  Color(0xffffffff),
                  Color(0xffffffff),
                  Color(0xffffffff),
                ]),
          ),
          child: Stack(
            alignment: Alignment.center,
            children: [
              Column(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  SvgPicture.asset(
                    AppImages.icon_submit_success,
                  ),
                  Text(
                    '提交成功',
                    style: TextStyle(
                        color: Colors.black,
                        fontSize: 18.sp,
                        fontWeight: FontWeight.bold),
                  ),
                ],
              ),
            ],
          ),
        ),
      ),
      onWillPop: () async {
        return Future.value(false);
      },
    );
  }
}
